Skip to content

build: docker build setting and make guideline#318

Merged
2yunseong merged 1 commit intomainfrom
build/317-docker-setting
Feb 25, 2026
Merged

build: docker build setting and make guideline#318
2yunseong merged 1 commit intomainfrom
build/317-docker-setting

Conversation

@2yunseong
Copy link
Collaborator

관련 이슈

작업 분류

  • 버그 수정
  • 신규 기능 추가
  • 프로젝트 구조 변경
  • 코드 스타일 변경
  • 기존 기능 개선
  • 문서 수정

PR을 통해 해결하려는 문제가 무엇인가요? 🚀

  • 인프라 변경에 의한 docker 세팅 및 문서화

PR에서 핵심적으로 변경된 부분이 어떤 부분인가요? 👀

  • dockerfile 추가됨

핵심 변경사항 이외 추가적으로 변경된 사항이 있나요? ➕

  • X

추가적으로, 리뷰어가 리뷰하며 알아야 할 정보가 있나요? 🙌

  • 없습니다!

이런 부분을 신경써서 봐주셨으면 좋겠어요. 🙋🏻‍♂️

  • 궁금한 점 질문해주세요~!

체크리스트 ✅

  • reviewers 설정
  • assignees 설정
  • label 설정

@gemini-code-assist
Copy link

Summary of Changes

Hello @2yunseong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 인프라 변경에 따라 프론트엔드 애플리케이션의 Docker 기반 배포 및 로컬 개발 환경 설정을 도입합니다. 이를 통해 개발자들이 일관된 환경에서 애플리케이션을 빌드하고 실행할 수 있도록 지원하며, 배포 과정을 문서화하여 효율성을 높이는 것을 목표로 합니다.

Highlights

  • Docker 설정 추가: 프론트엔드 애플리케이션을 위한 Dockerfile이 추가되었습니다.
  • 배포 가이드 문서화: Docker 이미지를 빌드, 실행, 푸시 및 EC2에 배포하는 방법에 대한 상세 가이드가 추가되었습니다.
  • 로컬 개발 가이드 제공: 백엔드 개발자가 로컬에서 프론트엔드를 Docker로 실행할 수 있도록 가이드 문서가 추가되었습니다.
  • 빌드 최적화: Docker 빌드 시 불필요한 파일을 제외하기 위한 .dockerignore 파일이 추가되었습니다.
  • 스크립트 업데이트: 데이터베이스 초기화 없이 Next.js 애플리케이션을 시작하는 start:no-db 스크립트가 package.json에 추가되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/docker-deployment-guide.md
    • Docker 이미지를 빌드, 로컬 실행, 레지스트리 푸시, EC2 배포하는 방법을 설명하는 상세 가이드가 추가되었습니다.
  • docs/local-docker-start-guide.md
    • 백엔드 개발자를 위한 로컬 Docker 환경에서 프론트엔드 API 테스트 방법을 안내하는 가이드가 추가되었습니다.
  • frontend/.dockerignore
    • Docker 빌드 시 node_modules, .next, .git 등 불필요한 파일과 디렉토리를 제외하도록 설정하는 파일이 추가되었습니다.
  • frontend/Dockerfile
    • Node.js 20 기반의 멀티스테이지 Dockerfile이 추가되어 의존성 설치, 애플리케이션 빌드, 프로덕션 환경 실행을 효율적으로 처리합니다.
  • frontend/package.json
    • 데이터베이스 초기화 없이 Next.js 애플리케이션을 시작할 수 있는 start:no-db 스크립트가 추가되었습니다.
Activity
  • 아직 풀 리퀘스트에 대한 사람의 활동은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 Docker 빌드 설정과 가이드 문서를 추가하여 배포 프로세스를 개선하는 좋은 시도입니다. 몇 가지 개선점을 제안합니다. docker-deployment-guide.md 문서의 워크플로우가 일부 혼란스러워 명확하게 수정할 필요가 있습니다. local-docker-start-guide.md의 빌드 명령어는 로컬 개발 환경에 더 적합하게 단순화할 수 있습니다. 마지막으로, Dockerfile에서 .env.production 파일을 최종 이미지에 복사하는 부분은 이미지의 재사용성을 낮추고 잠재적인 보안 위험을 초래할 수 있어 수정이 필요해 보입니다. 자세한 내용은 각 파일에 대한 개별 코멘트를 참고해주세요.

COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.js ./next.config.js
COPY --from=builder /app/.env.production ./.env.production

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

최종 runner 이미지에 .env.production 파일을 복사하는 것은 몇 가지 문제를 일으킬 수 있습니다.

  • 재사용성 저하: 빌드 시점의 환경 변수 값이 이미지에 하드코딩되어, 다른 환경(e.g., staging, production)에서 동일한 이미지를 다른 설정으로 재사용하기 어렵게 만듭니다.
  • 보안 위험: .env.production 파일에 API 키와 같은 민감한 정보가 포함된 경우, 해당 정보가 이미지 내에 그대로 저장됩니다. 이 이미지가 외부에 노출되면 보안 사고로 이어질 수 있습니다.

Next.js는 NEXT_PUBLIC_으로 시작하는 변수를 빌드 시점에 에셋에 포함시키므로, builder 스테이지에서 .env.production 파일을 사용하는 것은 올바른 접근입니다.

하지만 runner 스테이지에서는 이 파일을 복사하는 대신, docker run 명령어 실행 시 -e 옵션이나 --env-file 옵션을 사용하여 런타임에 환경 변수를 주입하는 것이 좋습니다.

따라서 이 라인을 제거하여 런타임 환경 변수에 의존하도록 수정하는 것을 강력히 권장합니다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker run -p 3000:3000 \
  --env-file frontend/.env.production \
  econo-recruit-fe:version

gemini 리뷰처럼 --env-file 추가해서 배포할때 env 를 숨기면 어떨까요?

Comment on lines +8 to +31
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t leeyunseong/econo-recruit-fe:<version> \
-f frontend/Dockerfile frontend \
--push
```

## 2) Run locally

```bash
docker run -d \
--name econo-recruit-fe \
-p 3000:3000 \
econo-recruit-fe:<version>
```

## 3) Push to registry

먼저 Docker Hub Push 권한을 관리자에게 요청 부탁드립니다.

```bash
docker tag econo-recruit-fe:<version> leeyunseong/econo-recruit-fe:<version>
docker push leeyunseong/econo-recruit-fe:<version>
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

배포 가이드의 내용이 일부 혼란스럽게 작성되어 있어 사용자가 따라하기 어려울 수 있습니다. 현재 가이드는 빌드, 로컬 실행, 푸시 단계가 서로 일관되지 않고 중복되는 부분이 있습니다.

  • 이미지 이름 불일치: 1번 단계에서 빌드한 이미지(leeyunseong/...)와 2번에서 실행하려는 이미지(econo-recruit-fe) 이름이 다릅니다.
  • 푸시 단계 중복: 1번의 build --push와 3번의 push가 중복됩니다.

명확한 워크플로우를 위해, 빌드와 푸시를 한번에 하는 방법 또는 빌드/테스트/푸시를 단계별로 하는 방법 중 하나로 통일하여 안내하는 것을 권장합니다.

또한, leeyunseong/econo-recruit-fe와 같이 개인 Docker Hub 사용자 이름을 사용하는 대신, <YOUR_DOCKERHUB_USERNAME>/<IMAGE_NAME>과 같은 플레이스홀더를 사용하거나 조직의 리포지토리를 사용하도록 안내하는 것이 좋습니다.

Comment on lines +34 to +37
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t econo-recruit-fe:<version> \
-f frontend/Dockerfile frontend \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

로컬 개발 환경에서 이미지를 빌드하는 경우, 보통 현재 사용 중인 아키텍처(e.g., amd64 or arm64)에 대해서만 빌드하면 충분합니다. docker buildx를 사용하여 여러 플랫폼용으로 빌드하는 것은 배포용 이미지를 만들 때 더 적합합니다.

로컬 실행 가이드인 만큼, 개발자들이 더 간단하게 사용할 수 있도록 docker build 명령어로 변경하는 것을 제안합니다. 이렇게 하면 --platform 옵션에 대해 고민할 필요가 없고, 빌드된 이미지가 바로 로컬 도커 데몬에 저장되어 실행하기 편리합니다.

Suggested change
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t econo-recruit-fe:<version> \
-f frontend/Dockerfile frontend \
docker build -t econo-recruit-fe:<version> -f frontend/Dockerfile frontend

Copy link
Collaborator

@cho-in-sik cho-in-sik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

설정 감사합니다! 적용되면 가이드대로 진행해보겠습니다~

Copy link
Collaborator

@dle234 dle234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가이드라인 잘 적어주셨네요~ 감사합니다! 질문 몇개 남겨놨어요!

COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.js ./next.config.js
COPY --from=builder /app/.env.production ./.env.production
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker run -p 3000:3000 \
  --env-file frontend/.env.production \
  econo-recruit-fe:version

gemini 리뷰처럼 --env-file 추가해서 배포할때 env 를 숨기면 어떨까요?

"dev": "next dev",
"build": "next build",
"start": "node database.js && next start",
"start:no-db": "next start",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배포할때 db.js 없이 실행하는 이유가 있을까요?
((사실 database.js 가 있는지도 처음 알았네요😭 이제는 사용하지 않는 로직인가요..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

백업용이라 production에서는 필요없을 듯 합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별도의 sqlite가 서버에 셋팅되고 있지않아서, no-db옵션을 추가한 것도 있습니다 ㅎㅎ

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하 답변 감사합니당!!

@2yunseong 2yunseong merged commit f5d055e into main Feb 25, 2026
1 check passed
@2yunseong 2yunseong deleted the build/317-docker-setting branch February 25, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FE] build: 인프라 이전을 위한 Docker 세팅

3 participants